﻿using DL.Characters.Player.FSM.StateMachine;
using DL.Tools;

namespace DL.Characters.Player.FSM.State
{
    public class PlayerCombatColdingState : PlayerCombatBaseState
    {
        /// <summary>
        /// 攻击冷却阶段
        /// </summary>
        /// <param name="playerStateMachine"></param>
        /// <param name="property"></param>
        public PlayerCombatColdingState(PlayerCombatStateMachine playerStateMachine, int property = 0) : base(playerStateMachine, property)
        {
        }
        
        public override void StateTransitionCompleted()
        {
            var act = WeaponCombotController.GetCurrentCombatAction();
            WeaponCombotController.SetAttackInputCommand(false);
            m_Timer = NewTimerManager.Inst.GetTimer(act.ActionColdTime, ActionColding);
            
            // var act = CombatController.GetCurrentCombatAction();
            // CombatController.SetAttackInputCommand(false);
            // m_Timer = NewTimerManager.Inst.GetTimer(act.ActionColdTime, ActionColding);
        }


        private GameTimer m_Timer;
        private void ActionColding()
        {
            // MoveController.EnableRootMotion = true;

            WeaponCombotController.UpdateCombat();
            StateMachine.ChangeState<PlayerCombatNullState>();
            
            // CombatController.SetAttackInputCommand(true);
            // StateMachine.ChangeState<PlayerCombatNullState>();
        }
    }
}